"use client";

import Nav from "@/base-framework/landing/Nav";
import Hero from "@/base-framework/landing/Hero";
import What from "@/base-framework/landing/What";
import How from "@/base-framework/landing/How";
import Features from "@/base-framework/landing/Features";
import FAQ from "@/base-framework/landing/FAQ";
import Footer from "@/base-framework/landing/Footer";
import type { LandingData, JsonLandingData } from "@/base-framework/types/landing";

// 动态导入所有配置文件
import seoData from "@/base-framework/content/landing/seo.json" assert { type: "json" };
import heroData from "@/base-framework/content/landing/hero.json" assert { type: "json" };
import whatData from "@/base-framework/content/landing/what.json" assert { type: "json" };
import howData from "@/base-framework/content/landing/how.json" assert { type: "json" };
import featuresData from "@/base-framework/content/landing/features.json" assert { type: "json" };
import faqData from "@/base-framework/content/landing/faq.json" assert { type: "json" };
import footerData from "@/base-framework/content/landing/footer.json" assert { type: "json" };

// 通过类型断言确保 JSON 数据符合 TypeScript 类型要求
const jsonData: JsonLandingData = {
  seo: seoData,
  hero: heroData,
  what: whatData,
  how: howData,
  features: featuresData,
  faq: faqData,
  footer: footerData
};

const landing = jsonData as LandingData;

export default function Home() {
  return (
    <div className="font-sans min-h-screen">
      <Nav />
      <main id="main">
        <Hero data={landing.hero} />
        {landing.what && <What items={landing.what.items} />}
        {landing.how && <How steps={landing.how.steps} />}
        {landing.features && <Features groups={landing.features.groups} />}
        {landing.faq && <FAQ items={landing.faq.items} />}
      </main>
      <Footer data={landing.footer} />
    </div>
  );
}